package com.snowfield.lbmonitor.serverStatus;

import java.util.HashMap;

/**
 * 服务/业务/运营状态
 */
public class SrvOpState {
    private final Integer opState;
    private final String status;
    private final String desc;

    private static final HashMap<Integer, SrvOpState> srvOpStateMap = new HashMap();

    static {
        srvOpStateMap.put(0, new SrvOpState(0, "STOPPED", "The server is down"));
        srvOpStateMap.put(1, new SrvOpState(1, "STARTING", "The server is warming up (up but throttled)"));
        srvOpStateMap.put(2, new SrvOpState(2, "RUNNING", "The server is fully up"));
        srvOpStateMap.put(3, new SrvOpState(3, "STOPPING", "The server is up but soft-stopping"));
    }

    private SrvOpState(Integer opState, String status, String desc) {
        this.opState = opState;
        this.status = status;
        this.desc = desc;
    }

    public static SrvOpState getInstance(Integer opState) {
        return srvOpStateMap.get(opState);
    }

    public Integer getOpState() {
        return opState;
    }

    public String getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }
}